﻿using System;
using System.Text.RegularExpressions;

namespace ValidatingNumbers
{
    class ValidatingNumbers
    {
        static void Main(string[] args)
        {
            string[] numbers =
            {
                "-0.0", "0", "33", "-2381.78132", "4.3347", "12.00", "0.34", "+3",
                "24 543", "01.23", "12.", "11,23", "--2", ".25", "-.25", "12е7"
            };
            string realNumbers = @"(\A((-\[1-9])|[1-9]|(-?[1-9][0-9]))\d*(\.\d)?\d*\Z)";
            string zeroNumbers = @"(\A(0|(-?(0\.\d+)))\Z)";
            string pattern = realNumbers + "|" + zeroNumbers;
            foreach (var item in numbers)
            {
                Match match = Regex.Match(item, pattern);
                while (match.Success)
                {
                    Console.WriteLine("Number: \"{0}\"", match);
                    match = match.NextMatch();
                }
            }
        }
    }
}